/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.mqtt.client.sample.controller;

import info.peigen.hotpot.component.gateway.mqtt.client.sample.service.MqttClientSampleService;
import org.noear.solon.annotation.Body;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.MethodType;

/**
 * <b>(MqttClientSampleController)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/7/19
 */
@Mapping("/mqtt/client")
@Controller
public class MqttClientSampleController {
    @Inject
    private MqttClientSampleService mqttClientSampleService;

    @Mapping("/publish")
    public boolean publish(@Body String body) {
        return mqttClientSampleService.publish(body);
    }

    @Mapping(value = "/sub", method = MethodType.GET)
    public boolean sub() {
        return mqttClientSampleService.sub();
    }

}